<?php
namespace Admin\Model;
use Think\Model;

class AgentModel extends Model {
	protected $tableName = 'agent'; 
	
	/**
	 *自动验证
	 */
	protected $_validate = array ( 
		
	);

	/**
	 *自动完成
	 */
	protected $_auto = array (
		
	);
	/*
	 *获取代理商
	 *@return：array  格式： 'id' => 'name'
	 *@author: wang.zheng
	*/
	public function getAgentOption(){
		$list = $this->field('id,agent_name,agent_status')->select();
		if(empty($list)){
			$arr = array();
		}
		foreach($list as $v){
			if ($v['agent_status']==1) {
				$a = "";
			} else {
				$a = "(停用)";
			}			
			$arr[$v['id']] = $v['agent_name'].$a;
		}
		//$arr = array_column($list,'agent_name' ,'id');
		return $arr;
	}
	

}